package com.xckj.cycling.viewmodel

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.junca.android.service.Request
import kotlinx.coroutines.launch

class SearchHistoryViewModel : ViewModel() {

    fun loadHistory() {

    }

    fun addHistory(text: String) {
        viewModelScope.launch {
            val r = Request.postSuspend<Any>(
                "qixing/cycling/searchRecordAdd",
                HashMap<String, Any>().apply {
                    put("key", text)
                    put("json", "{}")
                })
        }
    }

    fun clearHistory() {
        viewModelScope.launch {
            Request.postSuspend<Any>(
                "qixing/cycling/searchRecordDel"
            )
        }
    }

}